using System;
using System.Collections.Generic;
using System.Linq;
using OS.Infrastructure.Domain;
using OS.Infrastructure.NHibernate;
using OS.Infrastructure.NHibernate.Repositories;
using TaskKernel.Domain.Interface;

namespace TaskKernel.Domain.Nhibernate.NHibernateLayer
{
    public class QueryDepartment : BaseRepository<Department>, IQueryDepartment
    {
        public QueryDepartment(ISessionProvider sessionProvider, ILinqProvider linqProvider)
            : base(sessionProvider, linqProvider) {}

        #region IQueryDepartment Members

        public virtual Department GetDepartmentByWebPath(string webpath)
        {
            return FindBy(x => x.WebPath == webpath);
        }

        public virtual IEnumerable<Department> GetAllDepartments()
        {
            return All().OrderBy(x => x.DepartmentName);
        }

        public virtual Department GetDepartment(Guid id)
        {
            return FindBy(x => x.UID == id);
        }

        //public virtual Department GetDepartmentByCode(int code)
        //{
        //    return FindBy(x => x.Code == code);
        //}

        #endregion
    }
}